const san = require('/js-modules/common/san/san.js')

const RadioItem = san.defineComponent({
    template: `
        <div class="radioItem" on-click="change">
            <i s-if="{{model == value}}" class="iconfont">&#xe756;</i>
            <i s-else class="iconfont">&#xe757;</i>
            <span class="radio-text"><slot></slot></span>
        </div>
    `,
    change() {
        let val = this.data.get('value')
        this.data.set('model', val)
        this.dispatch('change', val)
    }
})

module.exports = RadioItem